<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>

        let arr = [3, 0, 6, 8, 0, 7, 2, 0, 0, 9, 0, 3, 1, 0];
        let newArr = [];

        for (let n of arr) {
            if (n) {
                newArr.push(n);
            }
        }
        console.log(newArr);

        //========================================
        newArr = arr.filter(x => {
            return x !== 0;
        });
        console.log(newArr);

    </script>
</body>

</html>